#ifndef AREALOADER_H
#define AREALOADER_H

#include <GameGlobals.h>
#include <string>
#include <list>
#include <map>

#define AddColorType( KeyName, R, G, B, TypeName ) \
	KeyName.data[ Color::MakeRGB(R, G, B) ] = new ObjectCreatorType<TypeName>(this)

namespace Color
{
	unsigned MakeRGB(unsigned char r, unsigned char g, unsigned char b);
}

class ObjectCreator;

struct ColorKey
{
	~ColorKey();
	std::map< unsigned, ObjectCreator* > data;
};

struct ColorData
{
	ColorData(unsigned char R,unsigned char G,unsigned char B,vec2 LOC):r(R),g(G),b(B),loc(LOC){}
	unsigned GetRGB() { return Color::MakeRGB(r,g,b); }
	unsigned char r;
	unsigned char g;
	unsigned char b;
	vec2 loc;
};

class Area;

namespace AreaLoader
{
	typedef unsigned char pixeltype;
	void LoadColorData(const std::string& filename, std::list< ColorData >& out_data);
	void ImportDataToArea(Area* area, std::list< ColorData >& colordata, ColorKey& key);
}


#endif